1 using System.Collections;
2 using
System.Collections.Generic;
3 using
UnityEngine;
4 using
UnityEngine.UI;
5
6 public
class ScoreCount : MonoBehaviour {
7
8     
public static ScoreCount instance;
9
10     
[SerializeField]
11     
public Text scoreText;
12
13     
public int countScore;
14     
int randScore;
15
16
17     
void Start () {
18         randScore = Random.Range(
2, 10);
19         MakeInstance();
20     }
21     
22     
void MakeInstance () {
23         
if (instance == null) {
24             instance =
this;
25         }
26     }
27
28     
public void CountScore(int score) {
29         
this.countScore += score;
30         scoreText.text =
"Score : " + this.countScore;
31         GameManager.instance.IfPlayerDied(
this.countScore);
32     }
33
34     
void Update() {
35       
36     }
37 }



Trò chơi Halloween vui nhộn trong UNITY Engine 10.806 lượt xem

Gõ tìm kiếm nhanh...